<template>
    <fieldset>
        <legend>详情页</legend>
        <h1>产品名称:{{ result.productName }}</h1>
        <h2>产品价格:{{ result.productPinkage }}</h2>
        <h2>创建时间:{{ result.productTime }}</h2>
    </fieldset>
</template>
<script>
export default {
    data() {
        return {
            result: {}
        }
    },
    props: ['productid'],
    mounted() {
        //获取动态路由参数

        // let productid = this.$route.params.productid;
        let productid = this.productid;

        // console.log(productid)

        //根据获取到的productid发起请求,请求详情页数据

        fetch(`http://chst.vip:1234/api/getmoneyctrlproduct?productid=${productid}`)
            .then(response => response.json())
            .then(res => {
                console.log(res)
                this.result = res.result[0]
            })
    }
}
</script>